/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-07-21
 * Time: 11:22
 */
public class Test1 {
    private static Object locker1 = new Object();

    private static Object locker2 = new Object();

    public static void main(String[] args) {
        Thread a = new Thread(() -> {
            synchronized(locker2) {
                try {
                    locker2.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("a");
            }
        });

        Thread b = new Thread(() -> {
            synchronized(locker1) {
                try {
                    locker1.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("b");
            }
            synchronized(locker2) {
                locker2.notify();
            }
        });

        Thread c = new Thread(() -> {
            synchronized(locker1) {
                System.out.println("c");
                locker1.notify();
            }
        });

        a.start();
        b.start();
        c.start();

    }
}
